<?php
	require (__DIR__.'/daos/MailCredentialsDao.php');
	require_once (__DIR__.'/daos/LogDao.php');
	
	
	//Generate Confirmcode
	$time = time();
	$code = rand(1, 99999999);
	
	// $email and $message are the data that is being
	// posted to this page from our html contact form
	$email = getDefaultRecipient() ;
	$subject = $time . $code;
	$message = "blas";

	//Configure PHPMailer
	$mail = getMailObject();

	//Mail an uns
	$mail->addAddress(getDefaultRecipient());     // Add a recipient
	$mail->isHTML(true);    // Set email format to HTML
	
	$mail->Subject = "$time$code";
	$mail->Body    = "insert into tabelle (email, text) values $email, $message";
	
	if(!$mail->send()) {
		writeError('Error beim Senden der Formulardaten: '. $mailToUs->ErrorInfo);
	} else {
		echo 'send complete';
	}
	
	//Mail an App-Developer
	$mail->addAddress($email);	// Add a recipient
	
	$mail->isHTML(true);    // Set email format to HTML
	$mail->Subject = $subject;
	$mail->Body    = $message;
	$mail->AltBody = $message;
	
	if(!$mail->send()) {
		writeError('Error beim Senden des Best�tigungslinks: '. $mailToDeveloper->ErrorInfo);
	} 
	
	echo 'test';
	
?>
